<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/14
 * Time: 14:44
 */

namespace app\index\model;


class BannerItem extends Base
{
    protected $table = 'sy_banner_item';
    protected $hidden = ['img_id', 'banner_id'];

    public function getTypeAttr($value)
    {
        $status = [
            0 => '无指向',
            1 => '商品',
            2 => '专题',
        ];
        return $status[$value];
    }


    public function banner()
    {
        return $this->belongsTo('Banner', 'banner_id', 'id');
    }

    public function img()
    {
        return $this->belongsTo('Image', 'img_id', 'id');
    }
}